﻿using System;
using Microsoft.Xna.Framework;

namespace OrganizedConfusion.Game_Objects
{
    public class Block : BaseObject
    {
        public Block()
        {
            type = BaseObject.OBJ_TYPE.OBJ_BLOCK;
        }

        public void Update(GameTime gametime)
        {

        }

        public override bool CheckCollision(BaseObject obj)
        {
            // TODO: Tweak collision and check all cases.
            if (obj.Type != (int)OBJ_TYPE.OBJ_PLAYER)
                return false;

            Player user = (Player)obj;

            // Circle Collision
            Vector2 MyPos = Position;
            Vector2 TheirPos = obj.Position;
            float MyRadius = ImageDimensions.X * 0.5f;
            float TheirRadius = obj.ImageDimensions.X * 0.5f;
            Vector2 Distance = MyPos - TheirPos;

            if (Distance.Length() < (MyRadius + TheirRadius))
            {
                user.Reset();
            }

            return false;
        }
    }
}
